package com.ruoyi.registerApprove.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.registerApprove.domain.RegisterApprove;
import com.ruoyi.registerApprove.service.IRegisterApproveService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 注册审批Controller
 * 
 * @author ruoyi
 * @date 2024-08-01
 */
@RestController
@RequestMapping("/registerApprove/approve")
public class RegisterApproveController extends BaseController
{
    @Autowired
    private IRegisterApproveService t06Service;

    /**
     * 查询注册审批列表
     */
    @PreAuthorize("@ss.hasPermi('registerApprove:approve:list')")
    @GetMapping("/list")
    public TableDataInfo list(RegisterApprove t06)
    {
        startPage();
        List<RegisterApprove> list = t06Service.selectRegisterApproveList(t06);
        return getDataTable(list);
    }

    /**
     * 导出注册审批列表
     */
    @PreAuthorize("@ss.hasPermi('registerApprove:approve:export')")
    @Log(title = "注册审批", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RegisterApprove t06)
    {
        List<RegisterApprove> list = t06Service.selectRegisterApproveList(t06);
        ExcelUtil<RegisterApprove> util = new ExcelUtil<RegisterApprove>(RegisterApprove.class);
        util.exportExcel(response, list, "注册审批数据");
    }

    /**
     * 获取注册审批详细信息
     */
    @PreAuthorize("@ss.hasPermi('registerApprove:approve:query')")
    @GetMapping(value = "/{F0601}")
    public AjaxResult getInfo(@PathVariable("F0601") Long F0601)
    {
        return success(t06Service.selectRegisterApproveByF0601(F0601));
    }

    /**
     * 新增注册审批
     */
    @PreAuthorize("@ss.hasPermi('registerApprove:approve:add')")
    @Log(title = "注册审批", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RegisterApprove t06)
    {
        return toAjax(t06Service.insertRegisterApprove(t06));
    }

    /**
     * 修改注册审批
     */
    @PreAuthorize("@ss.hasPermi('registerApprove:approve:edit')")
    @Log(title = "注册审批", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RegisterApprove t06)
    {
        return toAjax(t06Service.updateRegisterApprove(t06));
    }

    /**
     * 删除注册审批
     */
    @PreAuthorize("@ss.hasPermi('registerApprove:approve:remove')")
    @Log(title = "注册审批", businessType = BusinessType.DELETE)
	@DeleteMapping("/{F0601s}")
    public AjaxResult remove(@PathVariable Long[] F0601s)
    {
        return toAjax(t06Service.deleteRegisterApproveByF0601s(F0601s));
    }
}
